﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using BLL;
using System.Globalization;

namespace SearchEngine
{
    public partial class GoogleMAP : System.Web.UI.Page
    {
        #region Properties and Enumerators

        public enum MapStyle
        {
            G_NORMAL_MAP,
            G_SATELLITE_MAP,
            G_HYBRID_MAP,
            G_PHYSICAL_MAP
        };

        public int zoom { get; set; }
        public string mapContainer { get; set; }
        public MapStyle mapStyle { get; set; }
        public decimal latitude { get; set; }
        public decimal longitude { get; set; }
        public bool pushPin { get; set; }
        public string pushPinTitle { get; set; }
        public string pushPinDescription { get; set; }
        public string MapWidth { get; set; }
        public string MapHeight { get; set; }
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            InjectJavaScriptBingMaps();
        }
        public void InjectJavaScriptBingMaps()
        {
           /* StringBuilder sb = new StringBuilder();
            int ma = 0;
            ma = Convert.ToInt32(Request.QueryString["MA"].ToString());

            DataTable dt = SearchBUS.SelectOne(ma);
            DataRow dr = dt.Rows[0];
            latitude = Convert.ToDecimal(dr["KinhDo"].ToString());
            longitude = Convert.ToDecimal(dr["ViDo"].ToString());
            zoom = 17;
            pushPin = true;
            pushPinTitle = "Vị trí của địa điểm";
            pushPinDescription = dr["TenDiaDiem"].ToString();
            MapHeight = "400";
            MapWidth = "640";
            StringBuilder javascriptFunction = new StringBuilder();
            javascriptFunction.Append("getGoogleMaps(");
            javascriptFunction.Append("'mymap',");
            javascriptFunction.Append("" + latitude.ToString(CultureInfo.InvariantCulture.NumberFormat) + ",");
            javascriptFunction.Append("" + longitude.ToString(CultureInfo.InvariantCulture.NumberFormat) + ",");
            javascriptFunction.Append("" + zoom + ",");
            javascriptFunction.Append("" + pushPin.ToString().ToLower() + ",");
            javascriptFunction.Append("'" + pushPinTitle + "',");
            javascriptFunction.Append("'" + pushPinDescription + "',");
            javascriptFunction.Append("" + mapStyle + ",");
            javascriptFunction.Append("'" + MapWidth + "',");
            javascriptFunction.Append("'" + MapHeight + "'");
            javascriptFunction.Append(");");
            Page.ClientScript.RegisterStartupScript(GetType(), "Javascript", javascriptFunction.ToString(), true);*/
        }
    }
}
